package org.lc.stk.service.question.impl;

import org.lc.stk.service.question.FillBlankQuestionService;
import org.lc.stk.web.dto.question.FillBlankQuestionDTO;
import org.springframework.stereotype.Service;

@Service
public class FillBlankQuestionServiceImpl
    extends BaseQuestionServiceImpl<FillBlankQuestionDTO>
    implements FillBlankQuestionService {


    @Override
    public int countBlanks(String stemContent) {
        // 填空题空格计数逻辑
        return (int) stemContent.chars().filter(c -> c == '_').count();
    }

    @Override
    public boolean validateBlankFormat(String stemContent) {
        // 填空题格式验证逻辑
        return stemContent != null &&
               stemContent.matches(".*_{2,}.*") &&
               !stemContent.contains("__");
    }
}
